package org.sais.eswn.card;

import java.awt.Color;

public class Card {

    public static final int COLOR_WHITE = 1;
    public static final int COLOR_BLUE = 2;
    public static final int COLOR_GREEN = 4;
    public static final int COLOR_RED = 0;
    public static final int COLOR_BLACK = 3;
    public static final int CARDTYPE_CHARACTER = 0;
    public static final int CARDTYPE_SPELL = 1;
    public static final int CARDTYPE_HELP = 2;
    public String no;
    public String name;
    public CardText text;

    public Color getDisplayColor() {
        switch (getColor()) {
            case COLOR_WHITE:
                return new Color(240, 240, 240);
            case COLOR_BLUE:
                return new Color(220, 220, 255);
            case COLOR_BLACK:
                return new Color(210, 210, 210);
            case COLOR_RED:
                return new Color(255, 210, 210);
            case COLOR_GREEN:
                return new Color(210, 255, 210);
            default:
                return null;
        }
    }

    public int getColor() {
        String dno = no;
        switch (dno.charAt(0)) {
            case 'C':
                return COLOR_RED;
            case 'H':
                return COLOR_GREEN;
            case 'K':
                return COLOR_BLACK;
            case 'S':
                return COLOR_WHITE;
            case 'F':
                return COLOR_BLUE;
            default:
                return -1;
        }
    }

    public int getType() {
        switch (no.charAt(0)) {
            case 'H':
                return CARDTYPE_HELP;
            case 'C':
                return CARDTYPE_CHARACTER;
            default:
                return CARDTYPE_SPELL;
        }
    }

    public int getNumber() {
        return Integer.parseInt(no.substring(1));
    }

}
